(function() {"use strict";var __module = CC_EDITOR ? module : {exports:{}};var __filename = 'preview-scripts/assets/Script/Manager/ViewManager.js';var __require = CC_EDITOR ? function (request) {return cc.require(request, require);} : function (request) {return cc.require(request, __filename);};function __define (exports, require, module) {"use strict";
cc._RF.push(module, '8509dt9TtFFQIOmZqiwqC5G', 'ViewManager', __filename);
// Script/Manager/ViewManager.js

"use strict";

window.ViewMgr = {};

ViewMgr.showView = function (viewName) {
    console.log(viewName);

    ViewMgr.parent = cc.find("Canvas");

    var PrefabUrl = "Prefab/" + viewName + "Panel";
    //加载预制资源
    cc.loader.loadRes(PrefabUrl, function (errorMessage, loadedResource) {
        //检查资源加载
        if (errorMessage) {
            cc.log('载入预制资源失败, 原因:' + errorMessage);return;
        }
        if (!(loadedResource instanceof cc.Prefab)) {
            cc.log('你载入的不是预制资源!');return;
        }
        //开始实例化预制资源
        var panel = cc.instantiate(loadedResource);
        //将预制资源添加到父节点
        ViewMgr.parent.addChild(panel);

        console.log(viewName);
        var panelJs = require(viewName + "Panel");
        var panelObj = new panelJs();
        panelObj.viewName = viewName;
        panelObj.panel = panel;
        panelObj.awake();
    });
};

ViewMgr.hideView = function (viewName) {
    console.log(viewName);
};

module.exports = ViewMgr;

cc._RF.pop();
        }
        if (CC_EDITOR) {
            __define(__module.exports, __require, __module);
        }
        else {
            cc.registerModuleFunc(__filename, function () {
                __define(__module.exports, __require, __module);
            });
        }
        })();
        //# sourceMappingURL=ViewManager.js.map
        